home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-12 | 1.4 KB | 51 lines | [TEXT/CWIE] |
- /*
- CAddEntryAction.cp
-
- Copyright © 1995 Alastair Rankine.
- All Rights Reserved.
- */
-
- #include "CAddEntryAction.h"
- #include "CLookupDocument.h"
- #include "CEntry.h"
- #include "ResourceIDs.h"
- #include "CEntryList.h"
-
- #include <UAEGizmos.h>
-
- // -------------------------------------------------------------
- // CLASS CAddEntryAction
-
- CAddEntryAction::CAddEntryAction(CLookupDocument & inLookupDocument, const CEntry & inEntry)
- : LAEAction(STRx_RedoEdit, str_RedoAdd)
- {
- LAEStream redo(kAECoreSuite, kAECreateElement);
-
- // keyAEInsertHere - Create the record at the beginning of the document
- redo.WriteKey(keyAEInsertHere);
- redo.OpenRecord(typeInsertionLoc);
- redo.WriteKey(keyAEObject);
- redo.WriteSpecifier(&inLookupDocument);
- redo.WriteKey(keyAEPosition);
- redo.WriteEnumDesc(kAEBeginning);
- redo.CloseRecord();
-
- // keyAEObjectClass - Create a CEntry
- redo.WriteKey(keyAEObjectClass);
- redo.WriteTypeDesc(CEntry::kModelID);
-
- // keyAEPropData - Copy the properties from inEntry
- StAEDescriptor objProps;
- inEntry.GetDifferentAEProperties(sEmptyEntry, objProps.mDesc);
- redo.WriteKeyDesc(keyAEPropData, objProps.mDesc);
-
- // Close the redo, and assign the AE to the Redo event.
- StAEDescriptor createEvent;
- redo.Close(&createEvent.mDesc);
- SetRedoAE(createEvent.mDesc);
-
- // The undo AE is a lot simpler. Basically a delete event with the result from
- // the create as the direct parameter.
- SetUndoAE(kAECoreSuite, kAEDelete, true);
- }
-